package com.tangl.demo.rabbitMQ.exchange;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.UUID;

/**
 * @author: TangLiang
 * @date: 2020/8/18 10:56
 * @since: 1.0
 */
@Service
@Slf4j
public class SenderService {
//    @Resource
//    private RabbitTemplate rabbitTemplate;
//
//    /**
//     * 测试广播模式.
//     *
//     * @param p the p
//     * @return the response entity
//     */
//    public void broadcast(String p) {
//        CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
//        rabbitTemplate.convertAndSend("FANOUT_EXCHANGE", "", p, correlationData);
//    }
//
//    /**
//     * 测试Direct模式.
//     *
//     * @param p the p
//     * @return the response entity
//     */
//    public void direct(String p) {
//        CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
//        rabbitTemplate.convertAndSend("DIRECT_EXCHANGE", "DIRECT_ROUTING_KEY", p, correlationData);
//    }

}

